module Syspec

  # +Syspec::Definition+ is the first-pass class into which any Syspecfile is
  # loaded. It allows us to tot up conditions, requests and other interesting
  # aspects of the Syspec file before actually running it.
  #
  # This class is the reason why any code to execute only once is nested in a
  # block.
  #
  class Definition

    attr_accessor :conditions, :requests

    # Initializer the counters
    def initialize
      @conditions, @requests = 0, 0
    end
    
    def dump
      [@conditions, @requests]
    end
    
    def method_missing(meth, *args)
    end
    
    def fetch(*args)
      @request += 1
    end
    
    def update_condition(*args)
      @conditions += 1
    end

  end
end